#include <inc/mmu.h>
#define	RELOC(x) ((x) - KERNBASE)
#define MULTIBOOT_HEADER_MAGIC (0x1BADB002)
#define MULTIBOOT_HEADER_FLAGS (0)
#define CHECKSUM (-(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS))
#define VIDEO_MEMORY (0xB8000)
#define WHITE_ON_BLACK (0x0F)

.text
.align 4
.long MULTIBOOT_HEADER_MAGIC
.long MULTIBOOT_HEADER_FLAGS
.long CHECKSUM
.long VIDEO_MEMORY
.long WHITE_ON_BLACK

.globl _start
_start = RELOC(entry)

.globl entry
entry:
    #start
    movw $0x1234,0x472
    movl $(RELOC(entry_pgdir)), %eax
    movl %eax, %cr3
    movl %cr0, %eax
    orl $(CR0_PE|CR0_PG|CR0_WP),%eax
    movl %eax, %cr0
    mov	$relocated, %eax
	jmp	*%eax

relocated:
    movl $0x0,%ebp
    movl $(stacktop), %esp   
    call i386_init

spin:
    jmp spin



.data
	.p2align	PTXSHIFT		
	.globl		bootstack  
bootstack:
	.space		KSTKSIZE
	.globl		stacktop   
stacktop:


